home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / terminal / paket61 / cominit@.exe / COMINIT.DOC < prev   
Encoding:
Text File  |  1994-08-15  |  12.4 KB  |  224 lines

  1. COMINIT.COM   ver:1.00  February 1992               by Paul B. Webster.
  2.  ══════════════════════════════════════════════════════════════════════════
  3. COM port hardware
  4.  
  5.   You will virtually always be supplied with a COM port on purchase (or
  6.   acquisition?) of a PC.  And if you are operating Packet Radio or doing
  7.   anything else even remotely interesting you will need at least two COM
  8.   (serial) ports.  These may be on a plug-in card, usually together with a
  9.   parallel port using a chip especially designed to provide the parallel
  10.   port while pampering (providing the baudrate clock for) the serial port
  11.   chips.  Alternatively they may be on a board which includes the Floppy
  12.   Disk Controller, the Games (Joystick) port and a clock (in an XT) or even
  13.   on the motherboard.  A board which provides just a serial port is a rare
  14.   animal nowadays!
  15.  
  16.   There may be a set of jumpers to select whether or not either or both
  17.   ports are enabled, what addresses they appear at in the I/O map and what
  18.   IRQ lines they use; or there may be only one or no jumpers: "take it or
  19.   leave it".  It is quite common to have one COM port fitted on a card with
  20.   sockets for the chips to connect the second.  In this case an expansion
  21.   kit consisting of the Serial Port chip, RS-232 drivers and plug and cable
  22.   assembly is quite easy to fit.  The chip is usually an 8250 for a PC/XT
  23.   and a 82450 or 16450 (or 88450 etc. etc) for an AT.  While you are
  24.   welcome to install a 16550, paKet 5 will not utilise its extra
  25.   performance.  Note that the latter chips are totally plug-in compatible
  26.   swaps for the former; you can use a 16450 in your XT board.  The extra
  27.   RS-232 buffers (1488 and 1489) may be already soldered on the board (to
  28.   total two 1488 and three 1489) and the second serial port plug (usually a
  29.   9-pin) may already be on the board so that only the chip need be added.
  30.   A serial/multi-I/O card having square (about one inch) surface-mount
  31.   chips usually has the second port built-in already and few jumper options.
  32.  
  33.   One jumper option of particular note is that to configure the port or
  34.   ports as COM3 and/or COM4.  Such a board can be used in addition to a
  35.   fully-optioned dual-port or multi-I/O card to provide the third and
  36.   fourth COM ports.  There are a number of problems however including the
  37.   Interrupt (IRQ) allocations mentioned later.  The usual addresses of the
  38.   COM1 and COM2 ports are $3F8 and $2F8 respectively ($ = Hexadecimal).
  39.   Boards offering COM3 and COM4 usually allocate these at addresses $3E8
  40.   and $2E8 but some use other addresses.  By and large however if a board
  41.   has jumper options which are documented (you DO have the leaflet for the
  42.   board?) or marked on the PCB as either COM3 and COM4 or "3E8" and "2E8"
  43.   then these may be selected and the board plugged in additional to the
  44.   already fitted COM1 and COM2 board.
  45.  
  46.   Finally, Telephone Modem cards ("in-modems") contain a single serial port
  47.   chip as part of the interface with jumpers to select the address ("COM1"
  48.   to "COM4") and IRQ.
  49.  
  50.  
  51. Recognising COM3 and COM4
  52.  
  53.   To be frank, the BIOS provides a virtually unusable interface to the COM
  54.   ports, adequate only for the original purpose of connecting a serial
  55.   printer to the PC.  paKet however (as with all communications programs)
  56.   contains complete code for both outputting data to the COM port and
  57.   (where BIOS is deficient) inputting data from the port as it arrives.  To
  58.   do this latter, it uses the Interrupt function of the 8250/16450 Serial
  59.   Port chip to the PC bus.  It thus becomes necessary to ensure the "IRQ"
  60.   lines are correctly arranged.
  61.  
  62.   First things first though.  The (COM) ports must be accessible via their
  63.   I/O (input/output) addresses and so paKet must KNOW these addresses.  It
  64.   does so via DOS's (or more correctly, the BIOS) "Equipment List" which
  65.   reserves four addresses (memory locations $0000:0400 to 0407 to be exact)
  66.   to be COM1 to COM4.  These addresses if "empty" are zero.  BIOS performs
  67.   a search routine on boot-up to see if a COM port exists at certain
  68.   addresses.  PC/XT and AT BIOS looks at two addresses and "installs" as
  69.   many as found into the Equipment list.  SX/DX(80386) BIOS looks at at
  70.   least four addresses and installs up to the full four.  The accessory
  71.   program "COMINIT.COM" looks at up to eight plausible addresses to find
  72.   COM ports and installs up to four.  It can therefore be used to find and
  73.   install extra COM ports in a PX/XT/AT system and maybe in a 386 etc..
  74.  
  75.   Note one particular thing: BIOS or COMINIT search addresses in a certain
  76.   order and install ports as found into the Equipment List.  COM1 to COM4
  77.   are names of positions in the Equipment List, not names of addresses.
  78.   COM1 does NOT mean "address $3F8".  If for example a "COM3/COM4" board is
  79.   the only serial port board in the system, it becomes COM1 and COM2
  80.   whatever its addresses.  If a "COM3" board is added to a system with one
  81.   only previous COM port; it becomes COM2.
  82.  
  83.   paKet will only allow selection of COM ports that exist in the Equipment
  84.   List at the time.  In fact if the Equipment list somehow contains COM1
  85.   and COM3 but no COM2, or COM1, COM2 and COM4, then these ports and these
  86.   only may be selected.
  87.  
  88. Sharing interrupts
  89.  
  90.   Some cards offer only IRQ4 and IRQ3 for the com ports (these are the
  91.   standard allocations for COM1 and COM2 respectively) while others offer
  92.   IRQ2,3,4 and 5 or maybe...  There are problems when more than one port
  93.   uses or "shares" the same interrupt, so some software uses all four of
  94.   these interrupts if a four-port card is used.  As long as nothing ELSE
  95.   needs to use interrupts 2 and 5 that is.
  96.  
  97.   For paKet, the accepted "standard" is followed that COM1 and COM3 use if
  98.   not share IRQ4 while COM2 and COM4 use IRQ3.  If the port that BIOS
  99.   allocates to a particular COM port in the Equipment List does not have
  100.   its IRQ set to the corresponding value, it WILL NOT WORK (to be precise
  101.   in paKet it will output but fail to input data).  COMINIT may be used to
  102.   report the address allocations of the installed COM ports to locate the
  103.   offending jumpers (if they exist).
  104.  
  105.   Now it may be that you have a mouse on COM1, a telephone modem on COM2,
  106.   and have installed COM3 to run paKet.  COM1 and COM3 both use the same
  107.   interrupt line; the mouse is using that line because it is interrupt-
  108.   driven and paKet needs to use the line as it too is interrupt-
  109.   dependent.  There will be a clash as both serial port IRQ drivers are
  110.   enabled and paralleled to the same IRQ line (IRQ4 in the example).  A
  111.   method of resolving this is to replace the IRQ select jumper in BOTH
  112.   boards; that for COM1 and that for COM3 in this case; with a parallel
  113.   diode and resistor.
  114.  
  115.   This is most conveniently done by preparing a two-pin socket from a
  116.   length of pin-socket strip or from an IC socket (using a SHARP craft
  117.   knife).  The resistor (1K ohm) and diode (Silicon or Schottky signal
  118.   diode) are soldered in parallel to the socket piece at right angles to
  119.   the pins so that they do not foul the adjacent slot card (trim the socket
  120.   pins, too), and fitted in place of the original jumper so that the diode
  121.   cathode (band) is to the pin which leads to the motherboard. On a 3-pin
  122.   jumper where the three pins are "IRQ3-common-IRQ4", the diode cathode
  123.   faces AWAY from the common centre pin.
  124.  
  125.   Where DIP switches are used for the selection, the diode and resistor may
  126.   be soldered behind the board across the switch which would otherwise be
  127.   closed to make the IRQ selection and the switch left open; again so the
  128.   cathode faces the IRQ lines to the edge connector and the anode to the
  129.   common selection line for the particular port.
  130.  
  131.   For boards without the IRQ jumpers, a little ingenuity is called for.
  132.  
  133.   This arrangement comprises a diode-resistor OR gate where the two (or
  134.   possibly more) IRQ sources are OR'ed to the IRQ line.  Either diode will
  135.   pull the line high, or both resistors will pull it low.  paKet is coded
  136.   so that if on an interrupt it fails to find the serial chip has actually
  137.   generated one, it will "fall through" to the interrupt vector in
  138.   operation before paKet was executed.  If as in the example given, a mouse
  139.   has been installed on COM1, paKet using COM3 will check all interrupts on
  140.   IRQ4 and pass on to the mouse driver those which do not represent a
  141.   character received on COM3.  It is possible to use via the "F9 DOS call"
  142.   a program which uses the mouse but see below.
  143.  
  144. Limitations
  145.  
  146.   If the "Wired-OR" modification detailed above is implemented, please
  147.   remember that paKet is unusual in that it will pass on IRQ interrupts not
  148.   its own to a previously loaded program (usually a driver).  You cannot
  149.   expect that other programs will do this, so DO NOT run from the "F9"
  150.   function any program that uses either paKet's current COM port or that
  151.   port's IRQ line.  A mouse can share an IRQ line only if the mouse driver
  152.   is loaded beforehand (though the program that USES the driver might be
  153.   run from the "F9" function).
  154.  
  155.   Finally, the modification only guarantees that the two ports sharing the
  156.   IRQ can be simultaneously enabled.  Unfortunately, there remains a risk
  157.   that if both ports are simultaneously receiving information, such as
  158.   paKet being sent information from the TNC whilst the mouse is being
  159.   moved, interrupts from both ports will on occasion arrive within the time
  160.   it takes for them to be serviced and only one will in fact be serviced.
  161.   The unserviced port will then "hang" both ports.  A design "feature" of
  162.   the 8259 interrupt controller in the PC prevents it from detecting this
  163.   condition (which could also occur on a single port in a slow sytem at a
  164.   high baudrate).  If this happens, both ports will fail to receive data.
  165.   Data can still be sent to the TNC so paKet may be exited successfully.
  166.   Exiting from paKet may or may not clear the hangup (try out the mouse);
  167.   if it does not the system will have to be reset.  Note that this will NOT
  168.   hang any other part of the system; only the ports using that IRQ.
  169.   You might get away with this arrangement using a lower baudrate.
  170.  
  171.  
  172.  
  173. The COMINIT Program
  174.  
  175.   This utility attempts to locate COM ports beyond the first two installed
  176.   by the PC/XT/AT BIOS and install them in DOS's Equipment List to suit
  177.   paKet (or any other comms program supporting COM3 and COM4).  There are
  178.   four slots available in all, thus COM1 to COM4.  Generic SX (80386) BIOS
  179.   appears to attempt to fill all four slots, though I cannot vouch for
  180.   what assumptions it makes in the process.
  181.  
  182.   There are no options; simply invoke it as:
  183.      COMINIT
  184.  
  185.   Having verified that it performs the desired function, include it in
  186.   your AUTOEXEC.BAT file.
  187.  
  188.  ──────────────────────────────────────────────────────────────────────────
  189.  
  190.   What assumptions does COMINIT make?  Well, it looks at the following
  191.   addresses:   $3F8, $2F8, $3E8, $2E8, $2E0, $3E0, $2F0, and $260.
  192.  
  193.   It assumes that these addresses will alternately use IRQ4 and IRQ3.
  194.   Since paKet assumes that COM1 and COM3 use IRQ4 whilst COM2 and COM4 use
  195.   IRQ3, COMINIT will not bother to install port addresses in unsuitable
  196.   COM "slots".  Nor will it attempt to re-install a port in an suitable
  197.   slot if it finds it already installed in an "unsuitable" one; it just
  198.   reports where it has found it.
  199.  
  200.   Note that this initial version ASSUMES use of certain IRQ channels, it
  201.   does not test this (but an upgrade will do just that).  To summarise:
  202.  
  203.       COM1, COM3  »»  IRQ4  ««  ports $3F8, $3E8, $2E0 or $2F0
  204.       COM2, COM4  »»  IRQ3  ««  ports $2F8, $2E8, $3E0 or $260.
  205.  
  206.   Certain interesting things will be evident about COMINIT.  If you run it
  207.   twice, it will of course perform no installations the second time, but
  208.   will report all the previous allocations as it will of course if the
  209.   allocations have been made in some other manner.
  210.  
  211.   It will just as happily install COM1 and/or COM2 if these were not
  212.   installed on initialisation.  If for example a dual port board with the
  213.   $3E8 and $2E8 addresses is fitted as the only COM ports, the (XT/AT)
  214.   BIOS will take no notice of it, but COMINIT will install it as COM1 and
  215.   COM2.
  216.  
  217.  ──────────────────────────────────────────────────────────────────────────
  218.  
  219.   If you have any problems with COM ports, including the "sharing" of
  220.   interrupts you are quite welcome to forward enquiries to me, Paul,
  221.   VK2BZC @ VK2ATM.NSW.AUS.OC.
  222.  
  223.                                 Cheers!
  224.